import request from '@/utils/request'

export default {
  getTbMarketList(searchModel) {
    return request({
      url: '/tb/marketList',
      method: 'get',
      params: {
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize
      }
    })
  },
  updateMarket(market) {
    return request({
      url: '/tb/updateMarket',
      method: 'put',
      data: market
    })
  },
  addMarket(market) {
    return request({
      url: '/tb/addMarket',
      method: 'post',
      data: market
    })
  },
  saveMarket(market) {
    if (market.id == null && market.id === undefined) {
      return this.addMarket(market)
    }
    return this.updateMarket(market)
  },
  getMarketById(id) {
    return request({
      // url: '/user/' + id,
      url: `/tb/getMarketById/${id}`,
      method: 'get'
    })
  }
}
